package com.naodong.shenluntiku.mvp.view.activity;

import android.content.Intent;
import android.os.Bundle;

import com.naodong.shenluntiku.R;
import com.naodong.shenluntiku.mvp.model.bean.OnceTipType;
import com.naodong.shenluntiku.mvp.view.widget.HighLight;
import com.yatatsu.autobundle.AutoBundleField;

import me.shingohu.man.base.BaseMVPActivity;
import me.shingohu.man.di.component.AppComponent;

/**
 * Created by hujie on 17/6/7.
 */

public class OnceTipActivity extends BaseMVPActivity {

    @AutoBundleField
    String type;

    @AutoBundleField(required = false)
    int hightLightPositionX;
    @AutoBundleField(required = false)
    int hightLightPositionY;


    @Override
    protected void onCreateInit(Bundle savedInstanceState) {

        if (type.equals(OnceTipType.assessment_scroller_tip)) {
            findViewById(R.id.mainView).setOnClickListener(v -> {
                finish();
            });
        }
        if (type.equals(OnceTipType.study_set_tip)) {

            HighLight highLight = (HighLight) findViewById(R.id.hightLight);
            highLight.setHightLightPosition(new int[]{hightLightPositionX,hightLightPositionY});
            findViewById(R.id.setBtn).setOnClickListener(v -> {
                Intent intent = new Intent(mActivity, StudySetUpActivity.class);
                startActivity(intent);
                finish();
            });
        }
    }

    @Override
    public void overridePendingTransition(int enterAnim, int exitAnim) {
        super.overridePendingTransition(0, 0);
    }


    @Override
    protected boolean userAutoBindBundle() {
        return true;
    }

    @Override
    public boolean supportActionbar() {
        return false;
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {

    }

    @Override
    protected void setUpView() {
        int layoutId = layoutId();
        if (layoutId != 0) {
            setContentView(layoutId);
        }
    }

    @Override
    protected int layoutId() {
        if (type.equals(OnceTipType.assessment_scroller_tip)) {
            return R.layout.a_assessmentscroller_tip;
        } else if (type.equals(OnceTipType.study_set_tip)) {
            return R.layout.a_study_set_tip;
        }
        return 0;
    }
}
